ImageGear Professional DLL v18.1 for Windows
Detecting Image File Format
Send Feedback
ImageGear Professional v18.1 > User Guide > Using ImageGear > Loading and Saving Images > Loading Images > Detecting Image File Format

Glossary Item Box

You can detect the format of an image file before and after loading it in the HIGEAR handle using functions IG_fltr_detect_...():

All three functions return the type of image format as IG_FORMAT_ constant, as delineated in the accucnst.h file.

The code fragment below allows you to sort image files by their formats and then choose how to use them:

  Copy Code
AT_ERRCOUNT nErrCount = IGE_SUCCESS;/* will hold returned error count */
AT_MODE nFormatID;
...
nErrCount = IG_fltr_detect_file( "image.tiff", &nFormatID );
if( nFormatID==IG_FORMAT_TIF )
{
...
}

For better performance or for some other purposes, use the special functions IG_fltr_load_file_format() and IG_fltr_pagecount_file_format() if the image format is known. Those functions accept the first parameter as the format ID and do not perform detect operations like IG_fltr_load_file() does, but immediately start to operate with the data, assuming it from the specified format. If the data is invalid or the image format is different, then an error is placed in the error stack.

©2014. Accusoft Corporation. All Rights Reserved.